"IFIELD SHORTNAME, \"\", \"%s\"\n"
"IFIELD CONSTANT, \"0\", \"%s\"\n"
;
+static char xmap[] =
+"# gpsbabel XCSV style file\n"
+"#\n"
+"# Format: DeLorme Xmap Conduit\n"
+"# Author: Alex Mottram\n"
+"# Date: 12/09/2002\n"
+"#\n"
+"# \n"
+"# As defined in csv.c/xmap\n"
+"#\n"
+
+"DESCRIPTION DeLorme XMap HH Native .WPT\n"
+"EXTENSION wpt\n"
+
+"#\n"
+"# FILE LAYOUT DEFINITIIONS:\n"
+"#\n"
+"FIELD_DELIMITER COMMASPACE\n"
+"RECORD_DELIMITER NEWLINE\n"
+"BADCHARS COMMA\n"
+
+"PROLOGUE BEGIN SYMBOL\n"
+"EPILOGUE END\n"
+"#\n"
+"# INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE:\n"
+"#\n"
+"IFIELD LAT_HUMAN_READABLE, \"\", \"%08.5f\"\n"
+"IFIELD LON_HUMAN_READABLE, \"\", \"%08.5f\"\n"
+"IFIELD DESCRIPTION, \"\", \"%s\"\n"
+
+"OFIELD LAT_DECIMAL, \"\", \"%08.5f\"\n"
+"OFIELD LON_DECIMAL, \"\", \"%08.5f\"\n"
+"OFIELD DESCRIPTION, \"\", \"%s\"\n"
+;
static char xmap2006[] =
"# gpsbabel XCSV style file\n"
"#\n"
-;
-static char xmap[] =
-"# gpsbabel XCSV style file\n"
-"#\n"
-"# Format: DeLorme Xmap Conduit\n"
-"# Author: Alex Mottram\n"
-"# Date: 12/09/2002\n"
-"#\n"
-"# \n"
-"# As defined in csv.c/xmap\n"
-"#\n"
-
-"DESCRIPTION DeLorme XMap HH Native .WPT\n"
-"EXTENSION wpt\n"
-
-"#\n"
-"# FILE LAYOUT DEFINITIIONS:\n"
-"#\n"
-"FIELD_DELIMITER COMMASPACE\n"
-"RECORD_DELIMITER NEWLINE\n"
-"BADCHARS COMMA\n"
-
-"PROLOGUE BEGIN SYMBOL\n"
-"EPILOGUE END\n"
-"#\n"
-"# INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE:\n"
-"#\n"
-"IFIELD LAT_HUMAN_READABLE, \"\", \"%08.5f\"\n"
-"IFIELD LON_HUMAN_READABLE, \"\", \"%08.5f\"\n"
-"IFIELD DESCRIPTION, \"\", \"%s\"\n"
-
-"OFIELD LAT_DECIMAL, \"\", \"%08.5f\"\n"
-"OFIELD LON_DECIMAL, \"\", \"%08.5f\"\n"
-"OFIELD DESCRIPTION, \"\", \"%s\"\n"
;
static char xmapwpt[] =
"# gpsbabel XCSV style file\n"
"IFIELD IGNORE, \"\", \"%-.31s\"\n"
"IFIELD DESCRIPTION, \"\", \"%-.78s\"\n"
;
-style_vecs_t style_list[] = {{ "xmapwpt", xmapwpt } , { "xmap", xmap } , { "xmap2006", xmap2006 } , { "tomtom_itn", tomtom_itn } , { "tomtom_asc", tomtom_asc } , { "tabsep", tabsep } , { "sportsim", sportsim } , { "saplus", saplus } , { "s_and_t", s_and_t } , { "openoffice", openoffice } , { "nima", nima } , { "mxf", mxf } , { "mapconverter", mapconverter } , { "kwf2", kwf2 } , { "ktf2", ktf2 } , { "kompass_wp", kompass_wp } , { "kompass_tk", kompass_tk } , { "gpsman", gpsman } , { "gpsdrivetrack", gpsdrivetrack } , { "gpsdrive", gpsdrive } , { "geonet", geonet } , { "garmin_poi", garmin_poi } , { "garmin301", garmin301 } , { "fugawi", fugawi } , { "dna", dna } , { "custom", custom } , { "cup", cup } , { "csv", csv } , { "cambridge", cambridge } , { "arc", arc } , {0,0}};
+style_vecs_t style_list[] = {{ "xmapwpt", xmapwpt } , { "xmap2006", xmap2006 } , { "xmap", xmap } , { "tomtom_itn", tomtom_itn } , { "tomtom_asc", tomtom_asc } , { "tabsep", tabsep } , { "sportsim", sportsim } , { "saplus", saplus } , { "s_and_t", s_and_t } , { "openoffice", openoffice } , { "nima", nima } , { "mxf", mxf } , { "mapconverter", mapconverter } , { "kwf2", kwf2 } , { "ktf2", ktf2 } , { "kompass_wp", kompass_wp } , { "kompass_tk", kompass_tk } , { "gpsman", gpsman } , { "gpsdrivetrack", gpsdrivetrack } , { "gpsdrive", gpsdrive } , { "geonet", geonet } , { "garmin_poi", garmin_poi } , { "garmin301", garmin301 } , { "fugawi", fugawi } , { "dna", dna } , { "custom", custom } , { "cup", cup } , { "csv", csv } , { "cambridge", cambridge } , { "arc", arc } , {0,0}};
size_t nstyles = 30;
#else /* CSVFMTS_ENABLED */
style_vecs_t style_list[] = {{0,0}};
static char *opt_floating = NULL;
static char *opt_extrude = NULL;
static char *opt_trackdata = NULL;
+static char *opt_trackdirection = NULL;
static char *opt_units = NULL;
static char *opt_labels = NULL;
static char *opt_max_position_points = NULL;
static int floating;
static int extrude;
static int trackdata;
+static int trackdirection;
static int max_position_points;
static int indent_level;
kmlpt_unknown,
kmlpt_waypoint,
kmlpt_track,
- kmlpt_route
+ kmlpt_route,
+ kmlpt_other
} kml_point_type;
static int point3d_list_len;
"6", ARGTYPE_INT, ARG_NOMINMAX },
{"line_color", &opt_line_color,
"Line color, specified in hex AABBGGRR",
- "64eeee17", ARGTYPE_STRING, ARG_NOMINMAX },
+ "99ffac59", ARGTYPE_STRING, ARG_NOMINMAX },
{"floating", &opt_floating,
"Altitudes are absolute and not clamped to ground",
"0", ARGTYPE_BOOL, ARG_NOMINMAX },
{"trackdata", &opt_trackdata,
"Include extended data for trackpoints (default = 1)",
"1", ARGTYPE_BOOL, ARG_NOMINMAX },
+ {"trackdirection", &opt_trackdirection,
+ "Indicate direction of travel in track icons (default = 0)",
+ "0", ARGTYPE_BOOL, ARG_NOMINMAX },
{"units", &opt_units,
"Units used when writing comments ('s'tatute or 'm'etric)",
"s", ARGTYPE_STRING, ARG_NOMINMAX },
int freshness;
char *icon;
} kml_tracking_icons[] = {
- { 60, "http://maps.google.com/mapfiles/kml/pal4/icon15.png" }, // Red
- { 30, "http://maps.google.com/mapfiles/kml/pal4/icon31.png" }, // Yellow
- { 0, "http://maps.google.com/mapfiles/kml/pal4/icon62.png" }, // Green
+ { 60, "http://www.gpsbabel.org/apps/earth/youarehere-60.png" }, // Red
+ { 30, "http://www.gpsbabel.org/apps/earth/youarehere-30.png" }, // Yellow
+ { 0, "http://www.gpsbabel.org/apps/earth/youarehere-0.png" }, // Green
};
-#define ICON_NOSAT "http://maps.google.com/mapfiles/kml/pal3/icon59.png";
+#define ICON_NOSAT "http://www.gpsbabel.org/apps/earth//youarehere-warning.png";
#define ICON_WPT "http://maps.google.com/mapfiles/kml/pal4/icon61.png"
-#define ICON_TRK "http://maps.google.com/mapfiles/kml/pal4/icon60.png"
-#define ICON_RTE "http://maps.google.com/mapfiles/kml/pal4/icon61.png"
+#define ICON_TRK "http://www.gpsbabel.org/apps/earth/track-directional/track-none.png"
+#define ICON_RTE "http://www.gpsbabel.org/apps/earth/track-directional/track-none.png"
+#define ICON_DIR "http://www.gpsbabel.org/apps/earth/track-directional/track-%d.png" // format string where next arg is rotational degrees.
#define MYNAME "kml"
* and non-highlighted version of the style to allow the icons
* to magnify slightly on a rollover.
*/
-static void kml_write_bitmap_style(kml_point_type pt_type, const char *bitmap)
+static void kml_write_bitmap_style(kml_point_type pt_type, const char *bitmap,
+ const char *customstyle)
{
- char *style;
+ const char *style;
switch (pt_type) {
case kmlpt_track: style = "track"; break;
case kmlpt_route: style = "route"; break;
case kmlpt_waypoint: style = "waypoint"; break;
+ case kmlpt_other: style = customstyle; break;
default: fatal("kml_output_point: unknown point type"); break;
}
default: fatal("kml_output_point: unknown point type"); break;
}
+ switch (pt_type) {
+ case kmlpt_track: style = "#track"; break;
+ case kmlpt_route: style = "#route"; break;
+ default: fatal("kml_output_point: unknown point type"); break;
+ }
+
pt->longitude = waypointp->longitude;
pt->latitude = waypointp->latitude;
pt->altitude = waypointp->altitude == unknown_alt ? 0.0 : waypointp->altitude;
kml_output_description(waypointp);
kml_output_lookat(waypointp);
kml_output_timestamp(waypointp);
- kml_write_xml(0, "<styleUrl>%s</styleUrl>\n", style);
-#if 0
- // If we were to try to spin track icon to indication direction
- // of motion, it might look something like this. Unfortunately,
- // doing that causes a huge performance problem in Google Earth.
- kml_write_xml(0, "<Style><IconStyle><heading>%f</heading></IconStyle></Style>\n", 360 - waypointp->course);
-#endif
+
+ if (trackdirection && (pt_type == kmlpt_track)) {
+ char buf[100];
+ if (waypointp->speed < 1)
+ snprintf(buf, sizeof(buf), "%s-none", style);
+ else
+ snprintf(buf, sizeof(buf), "%s-%d", style,
+ (int) (waypointp->course / 22.5 + .5) % 16);
+ kml_write_xml(0, "<styleUrl>%s</styleUrl>\n", buf);
+ } else {
+ kml_write_xml(0, "<styleUrl>%s</styleUrl>\n", style);
+ }
+
kml_write_xml(1, "<Point>\n");
if (floating) {
kml_write_xml(0, "<altitudeMode>absolute</altitudeMode>\n");
floating = (!! strcmp("0", opt_floating));
extrude = (!! strcmp("0", opt_extrude));
trackdata = (!! strcmp("0", opt_trackdata));
+ trackdirection = (!! strcmp("0", opt_trackdirection));
kml_write_xml(0, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
// Style settings for bitmaps
if (route_waypt_count()) {
- kml_write_bitmap_style(kmlpt_route, ICON_RTE);
+ kml_write_bitmap_style(kmlpt_route, ICON_RTE, NULL);
}
if (track_waypt_count()) {
- kml_write_bitmap_style(kmlpt_track, ICON_TRK);
+ if (trackdirection) {
+ int i;
+ kml_write_bitmap_style(kmlpt_other, ICON_TRK, "track-none");
+ for (i = 0; i < 16; i++) {
+ char buf1[100];
+ char buf2[100];
+
+ sprintf(buf1, "track-%d", i);
+ sprintf(buf2, ICON_DIR, i);
+ kml_write_bitmap_style(kmlpt_other, buf2, buf1);
+ }
+ } else {
+ kml_write_bitmap_style(kmlpt_track, ICON_TRK, NULL);
+ }
}
- kml_write_bitmap_style(kmlpt_waypoint, ICON_WPT);
+ kml_write_bitmap_style(kmlpt_waypoint, ICON_WPT, NULL);
if (track_waypt_count() || route_waypt_count()) {
// Style settings for line strings